package com.geen.tuoke.ui.viewmodel

import androidx.lifecycle.MutableLiveData
import com.geen.tuoke.base.BaseViewModel
import com.geen.tuoke.network.api.apiService
import com.geen.tuoke.network.utils.CacheUtil
import com.geen.tuoke.utils.ext.request
import com.geen.tuoke.utils.ext.toastShort
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.RequestBody
import java.io.File

/**
 * @Author LuoJi
 * @Date 2021/12/30-17:25
 * @Desc
 */
class MainViewModel : BaseViewModel() {

    var takePicture = MutableLiveData<Boolean>()

    var tabHomeRestart = MutableLiveData<Boolean>()
    var tabPhoneRestart= MutableLiveData<Boolean>()

    init {
        refreshUserInfo()
    }

    fun refreshUserInfo(showLoading:Boolean = false) {
        request({ apiService.getMeInfo() }, {
            CacheUtil.saveUserInfo(userInfo = it)
        }, {
            toastShort(it.errorMsg)
        }, showLoading)

    }


}